昨天講了 Abstract Contract ,今天就把跟他長得很像的 Interface 吧!
本日合約:
pragma solidity ^0.4.25;
interface Animal {
function run(uint speed) external returns (uint);
}
contract Cat is Animal {
function run(uint speed) public returns (uint distance) {
return speed * speed;
}
}
contract Dog is Animal {
function run(uint speed) public returns (uint distance) {
return speed * 10;
}
}
本日影片:
https://youtu.be/8EYpLwQm5fg
Smart Contract 實戰教學播放清單:
https://www.youtube.com/playlist?list=PLHmOMPRfmOxSJcrlwyandWYiuP9ZAMYoF